﻿
Public Class strcmp
    Public Const functionName As String = "strcmp"

    Public Shared Sub invoke(ByVal inlineScript As inlineScript _
                             , ByVal firstStr As String, ByVal firstStart As Int64, ByVal firstEnd As Int64 _
                             , ByVal secondStr As String, ByVal secondStart As Int64, ByVal secondEnd As Int64 _
                             , ByVal ignoreCase As Boolean, ByRef actionTarget As String)
        assert(Not inlineScript Is Nothing, "inlineScript is nothing.")
        assert(Not isemptystring(firstStr), "firstStr is an empty string.")
        assert(Not isemptystring(secondStr), "secondStr is an empty string.")

        inlineScript.addscript(network.http.contentType.textjavascript, "strcmp" _
                                , "function " + functionName + "(str1,start1,len1,str2,start2,len2,ignoreCase) " _
                                + "{}")
    End Sub
End Class

Public Class toLowerCase
    Public Const functionName As String = "stl"

    Public Shared Sub register(ByVal inlineScript As inlineScript)
        assert(Not inlineScript Is Nothing)
        inlineScript.addscript(functionName, "function " + functionName + "(s){return s.toLowerCase();}")
    End Sub

    Public Shared Function invoke(ByVal inlineScript As inlineScript, ByVal s As String, _
                                  Optional ByRef actionTarget As String = Nothing) As String
        If Not inlineScript Is Nothing Then
            register(inlineScript)
        End If

        actionTarget += functionName + "(" + s + ")"
        Return actionTarget
    End Function
End Class